package stephen.com.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EmailUtil {
	/**
	 * 正则表达式校验邮箱
	 *
	 * @param email 邮箱
	 * @return true or false
	 */
	public static boolean checkEmail(String email) {
		if ( null == email || "".equals(email) ) {
			return false;
		} else {
			String regEx1 =
					"^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)" + "+[a" + "-zA-Z"
							+ "]{2," + "}$";
			Pattern p = Pattern.compile(regEx1);
			Matcher m = p.matcher(email);
			if ( m.matches() ) {
				return true;
			} else {
				return false;
			}
		}
	}
}
